#include "display.h"
//#include "key_process.h"
#include "sys_process.h"
#include "time_iic.h"
#include "soft_time.h"
#include "comm_rinnai.h"
#include "sc95f.h"
									//0 1 2 3 4 5 6 7 8 9 A U F E o t p d
uint8_t Aip_650_numb_display[18]={0x3f,0x06,0x5d,0x4f,0x66,0x6b,0x7b,0x0e,0x7f,0x6f,0X7e,0X37,0x78,0x79,0x53,0x71,0x7c,0x57};


uint8_t Aip_650_units_numb_display[14]={0xbf,0x86,0xdd,0xcf,0xe6,0xeb,0xfb,0x8e,0xff,0xef,0xfe,0xb7,0xf8,0xf9};


uint8_t Aip_33624_ring_tab[15]={
																g7|s9,
													g7|s7,			g6|s8,				
												g7|s5,					g6|s6,
											g7|s1,                           g6|s1,
										g7|s2,									g6|s2,
										  g2|s6,							g5|s1,
												g2|s7,					g4|s3,
														g4|s7,		g4|s4
};

uint8_t Aip_33624_ring_auto_tab[15]={g7|s2,g7|s1,g7|s5,g7|s7,g7|s9,g6|s8,g6|s6,g6|s1,g6|s2,g5|s1,g4|s3,g4|s4,g4|s7,g2|s7,g2|s6};

uint8_t breath_show_tab[41]=
{															

                                                                        g7|s10,		g6|s10,
                                                                    g7|s8,                g6|s9,
                                                                g7|s6,						g6|s7,
                                                            g7|s4,								g6|s5,
	g1|s7,g1|s6,g1|s2,g1|s1,g2|s1,g2|s2,g2|s3,g2|s4,g8|s3,g7|s3,					            	g6|s4,g6|s3,g8|s5,g5|s5,g3|s5,g3|s7,g3|s8,g3|s9,g3|s10,g3|s2,
                                                        g2|s10,	g2|s5,		                g5|s2,		g5|s4,
                                                            g2|s9,									g5|s6,
                                                                g2|s8,							g5|s3,
                                                                    g4|s8,					g4|s6,
                                                                        g4|s9,			g4|s5,
                                                                                    g4|s10

};


uint8_t tab_Breathing_light[64]={
	0  , 1  , 2  , 3  , 4  , 5  , 6  , 7  ,
	8  , 10 , 12 , 14 , 16 , 18 , 20 , 22 ,
	24 , 26 , 29 , 32 , 35 , 38 , 41 , 44 ,
	47 , 50 , 53 , 57 , 61 , 65 , 69 , 73 ,
	77 , 81 , 85 , 89 , 94 , 99 , 104, 109,
	114, 119, 124, 129, 134, 140, 146, 152,
	158, 164, 170, 176, 182, 188, 195, 202,
	209, 216, 223, 230, 237, 244, 251, 255
};


#define tab_length 14
#define tab_length1 14
uint8_t tab_Breathing_light1[14]={
 10,15,20,30,40,60,80, 100,120,140,160,180,220,255
};
uint8_t tab_Breathing_light3[14]={
 10,20,40, 60,80,100,120,140,160,180,200,220,240,255
};
uint8_t tab_Breathing_light2[14]={
 255,240,220,200,180,160,140,120,100,80,60,40,20,0
};

uint8_t comm_200ms_wait_time=0;
//uint8_t Tenths_digit_display_numb=0;
//uint8_t quintile_display_numb=0;
//uint8_t The_units_display_numb=0;
//uint8_t decade_display_numb=0;
//uint8_t ring_numb_count=0;
//uint8_t ring_numb_count2=0;
//uint8_t ring_numb_count3=0;

//uint8_t stir_fry_time_count1=0;
//uint8_t stir_fry_time_count2=0;
//uint8_t stir_fry_time_count3=3;
//uint8_t stir_fry_time_count4=0;

//uint8_t stir_fry_time_count_time_flg=0;
//uint8_t wind_speed_level_count=1;


//uint8_t button1_count=0;
//uint8_t button2_count=0;
//uint8_t button3_count=0;
//uint8_t button4_count=0;
//uint8_t KEY_TIMING_SHORT_COUNT=0;
//uint8_t breath_or_all_show_flg=0;

//uint8_t flow_flg=0;
//uint8_t flow_flg_count=0;
//uint8_t key_cnt_test=0;

uint8_t breath_time=0;
uint8_t	breath_number=0;

uint8_t breath_time1=0;
uint8_t	breath_number1=0;

uint8_t atuo_count=0;
uint8_t atuo_count1=0;

//Time LED_STIR_FRY_time;
//Time LED_SELF_HELP_time;
//Time KEY_TIMING_SHORT_time;

//Led_Display_Stat  Display_State=LED_POWER_ON;
//Led_Display_Stat  Display_State_old_status;

//void Aip650_display_control(void)
//{
//	 Tenths_digit_display_numb=0;
//	 quintile_display_numb=0;
//	 The_units_display_numb=0;
//	 decade_display_numb=0;



//	 Tenths_digit_display_numb=button1_count;
//	 quintile_display_numb=button2_count;
//	 The_units_display_numb=button3_count;
//	 decade_display_numb=button4_count;
//	 if(blink_flag_500ms)
//	 {
//		 //							十分位									个位											个分位 										十位
//			AiP650_display(Aip_650_numb_display[Tenths_digit_display_numb],Aip_650_numb_display[The_units_display_numb],Aip_650_numb_display[quintile_display_numb],Aip_650_numb_display[decade_display_numb]);

//	 }else
//	 {
//		 //							十分位									个位											个分位 										十位
//			AiP650_display(Aip_650_units_numb_display[Tenths_digit_display_numb],Aip_650_units_numb_display[The_units_display_numb],Aip_650_units_numb_display[quintile_display_numb],Aip_650_units_numb_display[decade_display_numb]);

//	 }

//}

void Aip650_all_show(void)
{
	AiP650_display(Aip_650_units_numb_display[8],Aip_650_units_numb_display[8],Aip_650_units_numb_display[8],Aip_650_units_numb_display[8]);
}
void Aip650_all_close(void)
{
	AiP650_display(0x00,0x00,0x00,0x00);
}

void AiP33624_display_control(void)
{
//	write_cmd(0x6C);            //GRID1~GRID6有效，RAM地址  固定
//	write_cmd(addr1);
//	AiP33624_start();					//开始
//	AiP33624_write(addr2);				//写入地址
//	AiP33624_write(dat);			//初始化数据
//	AiP33624_stop();					//结束


}

void AiP33624_ring_display_control(uint8_t ring_numb)
{
	uint16_t i=0;
	uint8_t s_bit=0;
	uint8_t addr1=0;
	uint8_t addr2=0;
	addr2=Aip_33624_ring_auto_tab[ring_numb];
	s_bit=addr2>>3;
	if(s_bit>7)
	{
		addr1=0x21;
	}else
	{
		addr1=0x20;
	}
		AiP33624_WriteData1(addr1,Aip_33624_ring_auto_tab[ring_numb]|0xc0,0xff);
}
void AiP33624_ring_display_close_control(uint8_t ring_numb)
{
	uint8_t s_bit=0;
	uint8_t addr1=0;
	uint8_t addr2=0;
	addr2=Aip_33624_ring_auto_tab[ring_numb];
	s_bit=addr2>>3;
	if(s_bit>7)
	{
		addr1=0x21;
	}else
	{
		addr1=0x20;
	}
	AiP33624_WriteData1(addr1,Aip_33624_ring_auto_tab[ring_numb]|0xc0,0x00);
}

void AiP33624_ring_all_show(void)
{
	uint8_t ring_count=0;
	for(ring_count;ring_count<=14;ring_count++)
	{
		AiP33624_ring_display_control(ring_count);
	}


}
void Aip33624_ring_all_close(void)
{
	uint8_t ring_count=0;
	for(ring_count;ring_count<=14;ring_count++)
	{
		AiP33624_ring_display_close_control(ring_count);
	}
}

uint8_t ring_delay_count=0;
uint8_t ring_delay_count_end_flg=0;
uint8_t ring_delay_count_start_flg=0;	
void Aip33624_ring_auto_show1(void)
{
	ring_delay_count_start_flg=1;
if(atuo_count>=14)
		{

			if(ring_delay_count_end_flg==14){
			atuo_count1=1;
			}else if(ring_delay_count_end_flg==15){
			atuo_count1=2;
			}
				
			if(atuo_count1==1)
				{
		
				}
				else if(atuo_count1==2)
				{
					
						if(Aip33624_ring_auto_one_show_flg==1){
						//圆环转一圈熄灭
							Aip33624_ring_all_close();
							Aip33624_ring_auto_one_show_flg=0;
							Aip33624_ring_auto_show_flg=0;
							Aip33624_ring_auto_one_show_end_flg=1;
							ring_delay_count_start_flg=0;				
						
						}
							atuo_count1=0;
							atuo_count=0;
							ring_delay_count_end_flg=0;
				}
			
			


		}
		else
		{

				if(ring_delay_count_end_flg-atuo_count==1){
					atuo_count++;				
				}			


		}
			
	//breath_led_all_close();	
	}
void ring_display_delay(void)
{
	if(Aip33624_ring_auto_show_flg==0){
		ring_delay_count_start_flg=0;
	}
	if(ring_delay_count_start_flg==1)
		{

			if(atuo_count==0&&ring_delay_count_end_flg==0){
				AiP33624_WriteData1(0x20,g2|s6|0xc0,tab_Breathing_light2[ring_delay_count]);
				AiP33624_WriteData1(0x20,g7|s2|0xc0,0xff);
				AiP33624_WriteData1(0x20,g7|s1|0xc0,0xff);
				AiP33624_WriteData1(0x20,g7|s5|0xc0,tab_Breathing_light3[ring_delay_count]);				

				ring_delay_count++;
				if(ring_delay_count>=tab_length1){
					ring_delay_count=0;
					ring_delay_count_end_flg=1;						
				}
			
			}else if(atuo_count==1&&ring_delay_count_end_flg==1)
			{
				AiP33624_WriteData1(0x20,g7|s2|0xc0,tab_Breathing_light2[ring_delay_count]);
				AiP33624_WriteData1(0x20,g7|s1|0xc0,0xff);
				AiP33624_WriteData1(0x20,g7|s5|0xc0,0xff);
				AiP33624_WriteData1(0x20,g7|s7|0xc0,tab_Breathing_light3[ring_delay_count]);					
				
				ring_delay_count++;
				if(ring_delay_count>=tab_length1){
					ring_delay_count=0;
					ring_delay_count_end_flg=2;						
				}	
			}else if(atuo_count==2&&ring_delay_count_end_flg==2)
			{

				AiP33624_WriteData1(0x20,g7|s1|0xc0,tab_Breathing_light2[ring_delay_count]);
				AiP33624_WriteData1(0x20,g7|s5|0xc0,0xff);
				AiP33624_WriteData1(0x20,g7|s7|0xc0,0xff);
				AiP33624_WriteData1(0x21,g7|s9|0xc0,tab_Breathing_light3[ring_delay_count]);	
				

				ring_delay_count++;
				if(ring_delay_count>=tab_length1){
					ring_delay_count=0;
					ring_delay_count_end_flg=3;						
				}			
			}else if(atuo_count==3&&ring_delay_count_end_flg==3)
			{

				AiP33624_WriteData1(0x20,g7|s5|0xc0,tab_Breathing_light2[ring_delay_count]);
				AiP33624_WriteData1(0x20,g7|s7|0xc0,0xff);
				AiP33624_WriteData1(0x21,g7|s9|0xc0,0xff);
				AiP33624_WriteData1(0x20,g6|s8|0xc0,tab_Breathing_light3[ring_delay_count]);	

				ring_delay_count++;
				if(ring_delay_count>=tab_length1){
					ring_delay_count=0;
					ring_delay_count_end_flg=4;						
				}							
			}else if(atuo_count==4&&ring_delay_count_end_flg==4)
			{
				AiP33624_WriteData1(0x20,g7|s7|0xc0,tab_Breathing_light2[ring_delay_count]);
				AiP33624_WriteData1(0x21,g7|s9|0xc0,0xff);
				AiP33624_WriteData1(0x20,g6|s8|0xc0,0xff);
				AiP33624_WriteData1(0x20,g6|s6|0xc0,tab_Breathing_light3[ring_delay_count]);	
				
				ring_delay_count++;				
				if(ring_delay_count>=tab_length1){
					ring_delay_count=0;
					ring_delay_count_end_flg=5;						
				}			
			}else if(atuo_count==5&&ring_delay_count_end_flg==5)
			{

				AiP33624_WriteData1(0x21,g7|s9|0xc0,tab_Breathing_light2[ring_delay_count]);
				AiP33624_WriteData1(0x20,g6|s8|0xc0,0xff);
				AiP33624_WriteData1(0x20,g6|s6|0xc0,0xff);
				AiP33624_WriteData1(0x20,g6|s1|0xc0,tab_Breathing_light3[ring_delay_count]);	
				
				ring_delay_count++;
				if(ring_delay_count>=tab_length1){
					ring_delay_count=0;
					ring_delay_count_end_flg=6;						
				}					
			}else if(atuo_count==6&&ring_delay_count_end_flg==6)
			{

				AiP33624_WriteData1(0x20,g6|s8|0xc0,tab_Breathing_light2[ring_delay_count]);
				AiP33624_WriteData1(0x20,g6|s6|0xc0,0xff);
				AiP33624_WriteData1(0x20,g6|s1|0xc0,0xff);
				AiP33624_WriteData1(0x20,g6|s2|0xc0,tab_Breathing_light3[ring_delay_count]);	
			
				ring_delay_count++;
				if(ring_delay_count>=tab_length1){
					ring_delay_count=0;
					ring_delay_count_end_flg=7;						
				}						
			}else if(atuo_count==7&&ring_delay_count_end_flg==7)
			{

				AiP33624_WriteData1(0x20,g6|s6|0xc0,tab_Breathing_light2[ring_delay_count]);
				AiP33624_WriteData1(0x20,g6|s1|0xc0,0xff);
				AiP33624_WriteData1(0x20,g6|s2|0xc0,0xff);
				AiP33624_WriteData1(0x20,g5|s1|0xc0,tab_Breathing_light3[ring_delay_count]);	

				ring_delay_count++;				
				if(ring_delay_count>=tab_length1){
					ring_delay_count=0;
					ring_delay_count_end_flg=8;						
				}	
			}else if(atuo_count==8&&ring_delay_count_end_flg==8)
			{

				AiP33624_WriteData1(0x20,g6|s1|0xc0,tab_Breathing_light2[ring_delay_count]);
				AiP33624_WriteData1(0x20,g6|s2|0xc0,0xff);
				AiP33624_WriteData1(0x20,g5|s1|0xc0,0xff);
				AiP33624_WriteData1(0x20,g4|s3|0xc0,tab_Breathing_light3[ring_delay_count]);					
				

				ring_delay_count++;
				if(ring_delay_count>=tab_length1){
					ring_delay_count=0;
					ring_delay_count_end_flg=9;						
				}					
			}else if(atuo_count==9&&ring_delay_count_end_flg==9)
			{

				AiP33624_WriteData1(0x20,g6|s2|0xc0,tab_Breathing_light2[ring_delay_count]);
				AiP33624_WriteData1(0x20,g5|s1|0xc0,0xff);
				AiP33624_WriteData1(0x20,g4|s3|0xc0,0xff);
				AiP33624_WriteData1(0x20,g4|s4|0xc0,tab_Breathing_light3[ring_delay_count]);					
				

				ring_delay_count++;
				if(ring_delay_count>=tab_length1){
					ring_delay_count=0;
					ring_delay_count_end_flg=10;						
				}					
			}else if(atuo_count==10&&ring_delay_count_end_flg==10)
			{

				AiP33624_WriteData1(0x20,g5|s1|0xc0,tab_Breathing_light2[ring_delay_count]);
				AiP33624_WriteData1(0x20,g4|s3|0xc0,0xff);
				AiP33624_WriteData1(0x20,g4|s4|0xc0,0xff);
				AiP33624_WriteData1(0x20,g4|s7|0xc0,tab_Breathing_light3[ring_delay_count]);					
				

				ring_delay_count++;
				if(ring_delay_count>=tab_length1){
					ring_delay_count=0;
					ring_delay_count_end_flg=11;						
				}					
			}else if(atuo_count==11&&ring_delay_count_end_flg==11)
			{

				AiP33624_WriteData1(0x20,g4|s3|0xc0,tab_Breathing_light2[ring_delay_count]);
				AiP33624_WriteData1(0x20,g4|s4|0xc0,0xff);
				AiP33624_WriteData1(0x20,g4|s7|0xc0,0xff);
				AiP33624_WriteData1(0x20,g2|s7|0xc0,tab_Breathing_light3[ring_delay_count]);					
				

				ring_delay_count++;
				if(ring_delay_count>=tab_length1){
					ring_delay_count=0;
					ring_delay_count_end_flg=12;						
				}					
			}else if(atuo_count==12&&ring_delay_count_end_flg==12)
			{

				AiP33624_WriteData1(0x20,g4|s4|0xc0,tab_Breathing_light2[ring_delay_count]);
				AiP33624_WriteData1(0x20,g4|s7|0xc0,0xff);
				AiP33624_WriteData1(0x20,g2|s7|0xc0,0xff);
				AiP33624_WriteData1(0x20,g2|s6|0xc0,tab_Breathing_light3[ring_delay_count]);					
				

				ring_delay_count++;
				if(ring_delay_count>=tab_length1){
					ring_delay_count=0;
					ring_delay_count_end_flg=13;						
				}					
			}else if(atuo_count==13&&ring_delay_count_end_flg==13)
			{

				AiP33624_WriteData1(0x20,g4|s7|0xc0,tab_Breathing_light2[ring_delay_count]);
				AiP33624_WriteData1(0x20,g2|s7|0xc0,0xff);
				AiP33624_WriteData1(0x20,g2|s6|0xc0,0xff);
				AiP33624_WriteData1(0x20,g7|s2|0xc0,tab_Breathing_light3[ring_delay_count]);					

				ring_delay_count++;
				if(ring_delay_count>=tab_length1){
					ring_delay_count=0;
					ring_delay_count_end_flg=14;						
				}					
			}else if(atuo_count==14&&ring_delay_count_end_flg==14)
			{
				
				AiP33624_WriteData1(0x20,g2|s7|0xc0,tab_Breathing_light2[ring_delay_count]);
				AiP33624_WriteData1(0x20,g2|s6|0xc0,0xff);
				AiP33624_WriteData1(0x20,g7|s2|0xc0,0xff);
				AiP33624_WriteData1(0x20,g7|s1|0xc0,tab_Breathing_light3[ring_delay_count]);		
				

				ring_delay_count++;
				if(ring_delay_count>=tab_length1){
					ring_delay_count=0;
					ring_delay_count_end_flg=15;						
				}					
	
			}

			
			
			
	
	}
}
uint8_t ring_auto_count=0;
void Aip650_ring_auto_show(void)
{
	
	uint8_t ring_auto_count1=0;
	uint8_t s_bit=0;
	uint8_t addr1=0;
	uint8_t addr2=0;
	
	uint8_t s_bit1=0;
	uint8_t addr11=0;
	uint8_t addr21=0;

	addr2=Aip_33624_ring_auto_tab[ring_auto_count];
	s_bit=addr2>>3;
	if(s_bit>7)
	{
		addr1=0x21;
	}else
	{
		addr1=0x20;
	}


		for(ring_auto_count1;ring_auto_count1<15;ring_auto_count1++)
	{
	addr21=Aip_33624_ring_auto_tab[ring_auto_count1];
	s_bit1=addr21>>3;
	if(s_bit1>7)
	{
		addr11=0x21;
	}else
	{
		addr11=0x20;
	}
	
		AiP33624_WriteData1(addr11,Aip_33624_ring_auto_tab[ring_auto_count1]|0xc0,0x00);
		}
	
		AiP33624_WriteData1(addr1,Aip_33624_ring_auto_tab[ring_auto_count++]|0xc0,0xff);
  if(ring_auto_count>=15)
	{
		ring_auto_count=0;
	}



}

void Aip33624_ring_auto_show(void)
{
	
	if(atuo_count>=13)
		{

			
				atuo_count1++;
			if(atuo_count1==1)
				{

				//	Aip650_ring_all_close();
					AiP33624_ring_display_close_control(12);
					AiP33624_ring_display_control(13);
					AiP33624_ring_display_control(14);
					AiP33624_ring_display_control(0);
					
					
				}
				else if(atuo_count1==2)
				{
							//Aip650_ring_all_close();
							AiP33624_ring_display_close_control(13);
							AiP33624_ring_display_control(14);
							AiP33624_ring_display_control(0);
							AiP33624_ring_display_control(1);
					
						if(Aip33624_ring_auto_one_show_flg==1){
						//圆环转一圈熄灭
							Aip33624_ring_all_close();
							Aip33624_ring_auto_one_show_flg=0;
							Aip33624_ring_auto_show_flg=0;
							Aip33624_ring_auto_one_show_end_flg=1;		
						
						}
							atuo_count1=0;
							atuo_count=0;
					
				}
			
			


		}
		else
		{
				//Aip650_ring_all_close();
			if(atuo_count>0){
			AiP33624_ring_display_close_control(atuo_count-1);
			}else if(atuo_count==0){
			AiP33624_ring_display_close_control(14);
			}
				//Aip650_ring_all_close();
				AiP33624_ring_display_control(atuo_count);
				AiP33624_ring_display_control(atuo_count+1);
				AiP33624_ring_display_control(atuo_count+2);
				atuo_count++;
		}
		
	}

//																											g7|s10,		g6|s10,
//																										g7|s8,        g6|s9,
//																									g7|s6,						g6|s7,
//																								g7|s4,								g6|s5,
//	g1|s7,g1|s6,g1|s2,g1|s1,g2|s1,g2|s2,g2|s3,g2|s4,g7|s3,						g6|s4,g6|s3,g5|s5,g3|s5,g3|s7,g3|s8,g3|s9,g3|s10,g3|s2,
//																							g2|s10,	g2|s5,		g5|s2,		g5|s4,
//																								g2|s9,									g5|s6,
//																									g2|s8,							g5|s3,
//																										g4|s8,					g4|s6,
//																											g4|s9,			g4|s5,
//																														g4|s10
	uint8_t diffuse_count1=0;

void Aip33624_diffuse_display1(void){
	uint8_t diffuse_count2=0;
uint8_t s_bit=0;
	uint8_t addr1=0;
	uint8_t addr2=0;

	if(diffuse_count1==0)
		{
	
				AiP33624_WriteData1(0x21,g7|s10|0xc0,0xff);
				AiP33624_WriteData1(0x21,g6|s10|0xc0,0xff);
			

				AiP33624_WriteData1(0x21,g4|s10|0xc0,0xff);


		}else if(diffuse_count1==1)
		{
			
				AiP33624_WriteData1(0x21,g4|s9|0xc0,0xff);
				AiP33624_WriteData1(0x20,g4|s5|0xc0,0xff);
		
				AiP33624_WriteData1(0x20,g7|s8|0xc0,0xff);
				AiP33624_WriteData1(0x21,g6|s9|0xc0,0xff);
			



		}else if(diffuse_count1==2)
		{
	
				AiP33624_WriteData1(0x20,g4|s8|0xc0,0xff);
				AiP33624_WriteData1(0x20,g4|s6|0xc0,0xff);
			
				AiP33624_WriteData1(0x20,g7|s6|0xc0,0xff);
				AiP33624_WriteData1(0x20,g6|s7|0xc0,0xff);
			



		}else if(diffuse_count1==3)
		{

				AiP33624_WriteData1(0x20,g2|s8|0xc0,0xff);
				AiP33624_WriteData1(0x20,g5|s3|0xc0,0xff);
			
				AiP33624_WriteData1(0x20,g2|s5|0xc0,0xff);
				AiP33624_WriteData1(0x20,g5|s2|0xc0,0xff);
			


		}else if(diffuse_count1==4)
		{
												

			
				AiP33624_WriteData1(0x20,g7|s3|0xc0,0xff);
				AiP33624_WriteData1(0x20,g6|s4|0xc0,0xff);
			
				AiP33624_WriteData1(0x20,g7|s4|0xc0,0xff);
				AiP33624_WriteData1(0x20,g6|s5|0xc0,0xff);
			

		}else if(diffuse_count1==5)
		{
			
				AiP33624_WriteData1(0x21,g2|s9|0xc0,0xff);
				AiP33624_WriteData1(0x20,g5|s6|0xc0,0xff);	
			
				AiP33624_WriteData1(0x20,g2|s4|0xc0,0xff);
				AiP33624_WriteData1(0x20,g6|s3|0xc0,0xff);
			
			
		}else if(diffuse_count1==6)
		{
				AiP33624_WriteData1(0x21,g2|s10|0xc0,0xff);
				AiP33624_WriteData1(0x20,g5|s4|0xc0,0xff);

				AiP33624_WriteData1(0x20,g2|s3|0xc0,0xff);
				AiP33624_WriteData1(0x20,g5|s5|0xc0,0xff);
	

		
		}else if(diffuse_count1==7)
		{
				AiP33624_WriteData1(0x20,g2|s2|0xc0,0xff);
				AiP33624_WriteData1(0x20,g3|s5|0xc0,0xff);
		


		}else if(diffuse_count1==8)
		{
				AiP33624_WriteData1(0x20,g2|s1|0xc0,0xff);
				AiP33624_WriteData1(0x20,g3|s7|0xc0,0xff);
		

	
		}else if(diffuse_count1==9)
		{
				AiP33624_WriteData1(0x20,g1|s1|0xc0,0xff);
				AiP33624_WriteData1(0x20,g3|s8|0xc0,0xff);



		}else if(diffuse_count1==10)
		{
				AiP33624_WriteData1(0x20,g1|s2|0xc0,0xff);
				AiP33624_WriteData1(0x21,g3|s9|0xc0,0xff);			

			
		}else if(diffuse_count1==11)
		{
	
				AiP33624_WriteData1(0x20,g1|s6|0xc0,0xff);
				AiP33624_WriteData1(0x21,g3|s10|0xc0,0xff);
			

		
		}else if(diffuse_count1==12)
		{
				AiP33624_WriteData1(0x20,g1|s7|0xc0,0xff);
				AiP33624_WriteData1(0x20,g3|s2|0xc0,0xff);
		
		}
			diffuse_count1++;
		if(diffuse_count1>=14){
			diffuse_count1=0;
				if(Aip33624_diffuse_one_display_flg==1){
						Aip33624_diffuse_one_display_flg=0;
						Aip33624_ring_auto_one_show_end_flg=0;
						Aip33624_diffuse_display_flg=0;
						for(diffuse_count2;diffuse_count2<41;diffuse_count2++){
						addr2=breath_show_tab[diffuse_count2];
						s_bit=addr2>>3;
						if(s_bit>7)
						{
							addr1=0x21;
						}else
						{
							addr1=0x20;
						}
						AiP33624_WriteData1(addr1,breath_show_tab[diffuse_count2]|0xc0,0xff);
					}				
				
				
				}else if(Aip33624_diffuse_one_display_flg==0){
						for(diffuse_count2;diffuse_count2<41;diffuse_count2++){
						addr2=breath_show_tab[diffuse_count2];
						s_bit=addr2>>3;
						if(s_bit>7)
						{
							addr1=0x21;
						}else
						{
							addr1=0x20;
						}
						AiP33624_WriteData1(addr1,breath_show_tab[diffuse_count2]|0xc0,0x00);
					}
				
				}


		}
}
void Aip33624_diffuse_display(void)
{
	uint8_t diffuse_count2=0;
	uint8_t s_bit=0;
	uint8_t addr1=0;
	uint8_t addr2=0;
	uint8_t i=0;
	uint8_t i1=0;
	uint8_t i2=0;
	uint8_t i3=0;
	uint8_t i4=0;
	uint8_t i5=0;
	uint8_t i6=0;
	uint8_t i7=0;
	uint8_t i8=0;
	uint8_t i9=0;
	uint8_t i10=0;
	uint8_t i11=0;
	if(diffuse_count1==0)
		{
			for(i;i<64;i++){
				AiP33624_WriteData1(0x21,g7|s10|0xc0,tab_Breathing_light[i]);
				AiP33624_WriteData1(0x21,g6|s10|0xc0,tab_Breathing_light[i]);
			
				AiP33624_WriteData1(0x21,g4|s9|0xc0,tab_Breathing_light[i]);
				AiP33624_WriteData1(0x20,g4|s5|0xc0,tab_Breathing_light[i]);
				AiP33624_WriteData1(0x21,g4|s10|0xc0,tab_Breathing_light[i]);
		//	delay(5000);
			}

		}else if(diffuse_count1==1)
		{
				for(i1;i1<64;i1++){
				AiP33624_WriteData1(0x20,g7|s8|0xc0,tab_Breathing_light[i1]);
				AiP33624_WriteData1(0x21,g6|s9|0xc0,tab_Breathing_light[i1]);
			
				AiP33624_WriteData1(0x20,g4|s8|0xc0,tab_Breathing_light[i1]);
				AiP33624_WriteData1(0x20,g4|s6|0xc0,tab_Breathing_light[i1]);
			//	delay(5000);
				}

		}else if(diffuse_count1==2)
		{
				for(i2;i2<64;i2++){
				AiP33624_WriteData1(0x20,g7|s6|0xc0,tab_Breathing_light[i2]);
				AiP33624_WriteData1(0x20,g6|s7|0xc0,tab_Breathing_light[i2]);
			
				AiP33624_WriteData1(0x20,g2|s8|0xc0,tab_Breathing_light[i2]);
				AiP33624_WriteData1(0x20,g5|s3|0xc0,tab_Breathing_light[i2]);
			//	delay(5000);
				}

		}else if(diffuse_count1==3)
		{
				for(i3;i3<64;i3++){
				AiP33624_WriteData1(0x20,g7|s4|0xc0,tab_Breathing_light[i3]);
				AiP33624_WriteData1(0x20,g6|s5|0xc0,tab_Breathing_light[i3]);
			
				AiP33624_WriteData1(0x21,g2|s9|0xc0,tab_Breathing_light[i3]);
				AiP33624_WriteData1(0x20,g5|s6|0xc0,tab_Breathing_light[i3]);
				//delay(5000);
					
				}
		}else if(diffuse_count1==4)
		{
//																										 g7|s10,		g6|s10,
//																										g7|s8,        g6|s9,
//																									g7|s6,						g6|s7,
//																								g7|s4,								g6|s5,
//	g1|s7,g1|s6,g1|s2,g1|s1,g2|s1,g2|s2,g2|s3,g2|s4,g7|s3,						g6|s4,g6|s3,g5|s5,g3|s5,g3|s7,g3|s8,g3|s9,g3|s10,g3|s2,
//																							g2|s10,	g2|s5,		g5|s2,		g5|s4,
//																								g2|s9,									g5|s6,
//																									g2|s8,							g5|s3,
//																										g4|s8,					g4|s6,
//																											g4|s9,			g4|s5,
//																														g4|s10
				for(i4;i4<64;i4++){
				AiP33624_WriteData1(0x20,g2|s4|0xc0,tab_Breathing_light[i4]);
				AiP33624_WriteData1(0x20,g7|s3|0xc0,tab_Breathing_light[i4]);
				AiP33624_WriteData1(0x20,g6|s4|0xc0,tab_Breathing_light[i4]);
				AiP33624_WriteData1(0x20,g6|s3|0xc0,tab_Breathing_light[i4]);
			
				AiP33624_WriteData1(0x21,g2|s10|0xc0,tab_Breathing_light[i4]);
				AiP33624_WriteData1(0x20,g2|s5|0xc0,tab_Breathing_light[i4]);
				AiP33624_WriteData1(0x20,g5|s2|0xc0,tab_Breathing_light[i4]);
				AiP33624_WriteData1(0x20,g5|s4|0xc0,tab_Breathing_light[i4]);
		//	delay(1000);
				}			

		}else if(diffuse_count1==5)
		{
				for(i5;i5<64;i5++){
				AiP33624_WriteData1(0x20,g2|s3|0xc0,tab_Breathing_light[i5]);
				AiP33624_WriteData1(0x20,g5|s5|0xc0,tab_Breathing_light[i5]);
	//			delay(5000);
				}
			
		}else if(diffuse_count1==6)
		{
				for(i6;i6<64;i6++){
				AiP33624_WriteData1(0x20,g2|s2|0xc0,tab_Breathing_light[i6]);
				AiP33624_WriteData1(0x20,g3|s5|0xc0,tab_Breathing_light[i6]);
	//		delay(5000);
				}
		}else if(diffuse_count1==7)
		{
				for(i7;i7<64;i7++){
				AiP33624_WriteData1(0x20,g2|s1|0xc0,tab_Breathing_light[i7]);
				AiP33624_WriteData1(0x20,g3|s7|0xc0,tab_Breathing_light[i7]);
	//	delay(5000);
				}
		}else if(diffuse_count1==8)
		{
				for(i8;i8<64;i8++){
				AiP33624_WriteData1(0x20,g1|s1|0xc0,tab_Breathing_light[i8]);
				AiP33624_WriteData1(0x20,g3|s8|0xc0,tab_Breathing_light[i8]);
	//		delay(5000);
				}
		}else if(diffuse_count1==9)
		{
				for(i9;i9<64;i9++){
				AiP33624_WriteData1(0x20,g1|s2|0xc0,tab_Breathing_light[i9]);
				AiP33624_WriteData1(0x21,g3|s9|0xc0,tab_Breathing_light[i9]);
	//		delay(5000);
				}
		}else if(diffuse_count1==10)
		{
				for(i10;i10<64;i10++){
				AiP33624_WriteData1(0x20,g1|s6|0xc0,tab_Breathing_light[i10]);
				AiP33624_WriteData1(0x21,g3|s10|0xc0,tab_Breathing_light[i10]);
		//	delay(5000);
				}
		}else if(diffuse_count1==11)
		{
				for(i11;i11<64;i11++){
				AiP33624_WriteData1(0x20,g1|s7|0xc0,tab_Breathing_light[i11]);
				AiP33624_WriteData1(0x20,g3|s2|0xc0,tab_Breathing_light[i11]);
		//	delay(5000);
				}
		}
						
		diffuse_count1++;
		if(diffuse_count1>=12){
			diffuse_count1=0;
				if(Aip33624_diffuse_one_display_flg==1){
						Aip33624_diffuse_one_display_flg=0;
						Aip33624_ring_auto_one_show_end_flg=0;
						Aip33624_diffuse_display_flg=0;
						for(diffuse_count2;diffuse_count2<41;diffuse_count2++){
						addr2=breath_show_tab[diffuse_count2];
						s_bit=addr2>>3;
						if(s_bit>7)
						{
							addr1=0x21;
						}else
						{
							addr1=0x20;
						}
						AiP33624_WriteData1(addr1,breath_show_tab[diffuse_count2]|0xc0,0xff);
					}				
				
				
				}else if(Aip33624_diffuse_one_display_flg==0){
						for(diffuse_count2;diffuse_count2<41;diffuse_count2++){
						addr2=breath_show_tab[diffuse_count2];
						s_bit=addr2>>3;
						if(s_bit>7)
						{
							addr1=0x21;
						}else
						{
							addr1=0x20;
						}
						AiP33624_WriteData1(addr1,breath_show_tab[diffuse_count2]|0xc0,0x00);
					}
				
				}


		}
	



}
void Aip33624_diffuse_display2(void)
{
	uint8_t diffuse_count2=0;
	uint8_t s_bit=0;
	uint8_t addr1=0;
	uint8_t addr2=0;
		flow_delay_count_start_flg=1;
		if(flow_delay_count_end_flg-diffuse_count1==1||diffuse_count1>=14){
		diffuse_count1++;
		}				
//		diffuse_count1++;
		if(diffuse_count1>=15)//显示延迟
			{
			diffuse_count1=0;
//			flow_delay_count_start_flg=0;	
			flow_delay_count_end_flg=0;			
				if(Aip33624_diffuse_one_display_flg==1){
						Aip33624_diffuse_one_display_flg=0;
						Aip33624_ring_auto_one_show_end_flg=0;
						Aip33624_diffuse_display_flg=0;
						for(diffuse_count2;diffuse_count2<41;diffuse_count2++){
						addr2=breath_show_tab[diffuse_count2];
						s_bit=addr2>>3;
						if(s_bit>7)
						{
							addr1=0x21;
						}else
						{
							addr1=0x20;
						}
						AiP33624_WriteData1(addr1,breath_show_tab[diffuse_count2]|0xc0,0xff);
					}				
				
				
				}else if(Aip33624_diffuse_one_display_flg==0){
						for(diffuse_count2;diffuse_count2<41;diffuse_count2++){
						addr2=breath_show_tab[diffuse_count2];
						s_bit=addr2>>3;
						if(s_bit>7)
						{
							addr1=0x21;
						}else
						{
							addr1=0x20;
						}
						AiP33624_WriteData1(addr1,breath_show_tab[diffuse_count2]|0xc0,0x00);
					}
				
				}


		}
	



}
uint8_t flow_delay_count=0;
uint8_t flow_delay_count_end_flg=0;
uint8_t flow_delay_count_start_flg=0;	
void flow_display_delay2(void){
	if(Aip33624_diffuse_display_flg==0&&Aip33624_ring_auto_one_show_end_flg==0){
			flow_delay_count_start_flg=0;
	}
	if(flow_delay_count_start_flg==1){
		if(diffuse_count1==0&&flow_delay_count_end_flg==0)
			{
				AiP33624_WriteData1(0x21,g7|s10|0xc0,tab_Breathing_light1[flow_delay_count]);
				AiP33624_WriteData1(0x21,g6|s10|0xc0,tab_Breathing_light1[flow_delay_count]);
		
				AiP33624_WriteData1(0x21,g4|s10|0xc0,tab_Breathing_light1[flow_delay_count]);
				flow_delay_count++;
				if(flow_delay_count>=tab_length){
						flow_delay_count=0;
						flow_delay_count_end_flg=1;
				}
		}else if(diffuse_count1==1&&flow_delay_count_end_flg==1)
		{
				AiP33624_WriteData1(0x21,g4|s9|0xc0,tab_Breathing_light1[flow_delay_count]);
				AiP33624_WriteData1(0x20,g4|s5|0xc0,tab_Breathing_light1[flow_delay_count]);
		
				AiP33624_WriteData1(0x20,g7|s8|0xc0,tab_Breathing_light1[flow_delay_count]);
				AiP33624_WriteData1(0x21,g6|s9|0xc0,tab_Breathing_light1[flow_delay_count]);
				flow_delay_count++;			
				if(flow_delay_count>=tab_length){
						flow_delay_count=0;
						flow_delay_count_end_flg=2;
				}		
		}else if(diffuse_count1==2&&flow_delay_count_end_flg==2)
		{
				AiP33624_WriteData1(0x20,g4|s8|0xc0,tab_Breathing_light1[flow_delay_count]);
				AiP33624_WriteData1(0x20,g4|s6|0xc0,tab_Breathing_light1[flow_delay_count]);
			
				AiP33624_WriteData1(0x20,g7|s6|0xc0,tab_Breathing_light1[flow_delay_count]);
				AiP33624_WriteData1(0x20,g6|s7|0xc0,tab_Breathing_light1[flow_delay_count]);	
				flow_delay_count++;				
				if(flow_delay_count>=tab_length){
						flow_delay_count=0;
						flow_delay_count_end_flg=3;
				}					
		}	else if(diffuse_count1==3&&flow_delay_count_end_flg==3)
		{
				AiP33624_WriteData1(0x20,g2|s8|0xc0,tab_Breathing_light1[flow_delay_count]);
				AiP33624_WriteData1(0x20,g5|s3|0xc0,tab_Breathing_light1[flow_delay_count]);
			
				AiP33624_WriteData1(0x20,g2|s5|0xc0,tab_Breathing_light1[flow_delay_count]);
				AiP33624_WriteData1(0x20,g5|s2|0xc0,tab_Breathing_light1[flow_delay_count]);
				flow_delay_count++;				
				if(flow_delay_count>=tab_length){
						flow_delay_count=0;
						flow_delay_count_end_flg=4;
				}					
/*
																													g7|s10,		g6|s10,
																												g7|s8,        g6|s9,
																											g7|s6,						g6|s7,
																										g7|s4,								g6|s5,
	g1|s7,g1|s6,g1|s2,g1|s1,g2|s1,g2|s2,g2|s3,g2|s4,		g7|s3,						g6|s4,g6|s3,		g5|s5,g3|s5,g3|s7,g3|s8,g3|s9,g3|s10,g3|s2,
																									g2|s10,	g2|s5,		g5|s2,		g5|s4,
																										g2|s9,									g5|s6,
																											g2|s8,							g5|s3,
																												g4|s8,					g4|s6,
																													g4|s9,			g4|s5,
																																g4|s10				
				
				*/				
				
		}else if(diffuse_count1==4&&flow_delay_count_end_flg==4)
		{
				AiP33624_WriteData1(0x20,g7|s3|0xc0,tab_Breathing_light1[flow_delay_count]);
				AiP33624_WriteData1(0x20,g6|s4|0xc0,tab_Breathing_light1[flow_delay_count]);
			
				AiP33624_WriteData1(0x20,g7|s4|0xc0,tab_Breathing_light1[flow_delay_count]);
				AiP33624_WriteData1(0x20,g6|s5|0xc0,tab_Breathing_light1[flow_delay_count]);
			
			  AiP33624_WriteData1(0x20,g8|s5|0xc0,tab_Breathing_light1[flow_delay_count]);
				AiP33624_WriteData1(0x20,g6|s3|0xc0,tab_Breathing_light1[flow_delay_count]);	
				flow_delay_count++;				
				if(flow_delay_count>=tab_length){
						flow_delay_count=0;
						flow_delay_count_end_flg=5;
				}					
		}else if(diffuse_count1==5&&flow_delay_count_end_flg==5)
		{
				AiP33624_WriteData1(0x21,g2|s9|0xc0,tab_Breathing_light1[flow_delay_count]);
				AiP33624_WriteData1(0x20,g5|s6|0xc0,tab_Breathing_light1[flow_delay_count]);	
			
				AiP33624_WriteData1(0x21,g2|s10|0xc0,tab_Breathing_light1[flow_delay_count]);
				AiP33624_WriteData1(0x20,g5|s4|0xc0,tab_Breathing_light1[flow_delay_count]);			
			//新增两个灯
		
			
				flow_delay_count++;				
				if(flow_delay_count>=tab_length){
						flow_delay_count=0;
						flow_delay_count_end_flg=6;
				}				
		}else if(diffuse_count1==6&&flow_delay_count_end_flg==6)
		{
				AiP33624_WriteData1(0x20,g2|s4|0xc0,tab_Breathing_light1[flow_delay_count]);
				AiP33624_WriteData1(0x20,g8|s3|0xc0,tab_Breathing_light1[flow_delay_count]);	


//				AiP33624_WriteData1(0x20,g2|s3|0xc0,tab_Breathing_light1[flow_delay_count]);
//				AiP33624_WriteData1(0x20,g5|s5|0xc0,tab_Breathing_light1[flow_delay_count]);
				flow_delay_count++;				
				if(flow_delay_count>=tab_length){
						flow_delay_count=0;
						flow_delay_count_end_flg=7;
				}	
		}else if(diffuse_count1==7&&flow_delay_count_end_flg==7)
		{
				AiP33624_WriteData1(0x20,g2|s3|0xc0,tab_Breathing_light1[flow_delay_count]);
				AiP33624_WriteData1(0x20,g5|s5|0xc0,tab_Breathing_light1[flow_delay_count]);

				flow_delay_count++;				
				if(flow_delay_count>=tab_length){
						flow_delay_count=0;
						flow_delay_count_end_flg=8;
				}	
			
		}else if(diffuse_count1==8&&flow_delay_count_end_flg==8)
		{
				AiP33624_WriteData1(0x20,g2|s2|0xc0,tab_Breathing_light1[flow_delay_count]);
				AiP33624_WriteData1(0x20,g3|s5|0xc0,tab_Breathing_light1[flow_delay_count]);
			

				flow_delay_count++;				
				if(flow_delay_count>=tab_length){
						flow_delay_count=0;
						flow_delay_count_end_flg=9;
				}							
		}else if(diffuse_count1==9&&flow_delay_count_end_flg==9)
		{
				AiP33624_WriteData1(0x20,g2|s1|0xc0,tab_Breathing_light1[flow_delay_count]);
				AiP33624_WriteData1(0x20,g3|s7|0xc0,tab_Breathing_light1[flow_delay_count]);
			

				flow_delay_count++;				
				if(flow_delay_count>=tab_length){
						flow_delay_count=0;
						flow_delay_count_end_flg=10;
				}					
		}else if(diffuse_count1==10&&flow_delay_count_end_flg==10)
		{

				AiP33624_WriteData1(0x20,g1|s1|0xc0,tab_Breathing_light1[flow_delay_count]);
				AiP33624_WriteData1(0x20,g3|s8|0xc0,tab_Breathing_light1[flow_delay_count]);			

				flow_delay_count++;				
				if(flow_delay_count>=tab_length){
						flow_delay_count=0;
						flow_delay_count_end_flg=11;
				}					
		}else if(diffuse_count1==11&&flow_delay_count_end_flg==11)
		{
				AiP33624_WriteData1(0x20,g1|s2|0xc0,tab_Breathing_light1[flow_delay_count]);
				AiP33624_WriteData1(0x21,g3|s9|0xc0,tab_Breathing_light1[flow_delay_count]);	
			
			
	
				flow_delay_count++;				
				if(flow_delay_count>=tab_length){
						flow_delay_count=0;
						flow_delay_count_end_flg=12;
				}				
		}else if(diffuse_count1==12&&flow_delay_count_end_flg==12)
		{
				AiP33624_WriteData1(0x20,g1|s6|0xc0,tab_Breathing_light1[flow_delay_count]);
				AiP33624_WriteData1(0x21,g3|s10|0xc0,tab_Breathing_light1[flow_delay_count]);

				flow_delay_count++;	
				if(flow_delay_count>=tab_length){
						flow_delay_count=0;
						flow_delay_count_end_flg=13;
				}				
		}else if(diffuse_count1==13&&flow_delay_count_end_flg==13)
		{
			
				AiP33624_WriteData1(0x20,g1|s7|0xc0,tab_Breathing_light1[flow_delay_count]);
				AiP33624_WriteData1(0x20,g3|s2|0xc0,tab_Breathing_light1[flow_delay_count]);
			

				flow_delay_count++;	
				if(flow_delay_count>=tab_length){
						flow_delay_count=0;
						flow_delay_count_end_flg=14;
				}					
		}
	
	}
		

}
/*

void AiP33624_flow1_display_control(uint8_t flow_numb)
{
	uint8_t s_bit;
	uint8_t addr1;
	uint8_t addr2;
	addr2=AiP33624_flow1_numb_display[flow_numb];
	s_bit=addr2>>3;
	if(s_bit>7)
	{
		addr1=0x21;
	}else
	{
		addr1=0x20;
	}
	AiP33624_WriteData2(addr1,AiP33624_flow1_numb_display[flow_numb]|0xc0,0x00,0xff);
}

void AiP33624_flow2_display_control(uint8_t flow_numb)
{
	uint8_t s_bit;
	uint8_t addr1;
	uint8_t addr2;
	uint8_t s_bit1;
	uint8_t addr11;
	uint8_t addr21;
	addr2=AiP33624_flow2_numb_display[flow_numb];
	s_bit=addr2>>3;
	if(s_bit>7)
	{
		addr1=0x21;
	}else
	{
		addr1=0x20;
	}
	addr2=AiP33624_flow3_numb_display[flow_numb];
	s_bit1=addr21>>3;
	if(s_bit1>7)
	{
		addr11=0x21;
	}else
	{
		addr11=0x20;
	}
	AiP33624_WriteData2(addr1,AiP33624_flow2_numb_display[flow_numb]|0xc0,0x00,0xff);

	AiP33624_WriteData1(addr11,AiP33624_flow3_numb_display[flow_numb]|0xc0,0xff);
}
void AiP33624_flow3_display_control(uint8_t flow_numb)
{
	uint8_t s_bit;
	uint8_t addr1;
	uint8_t addr2;
	addr2=AiP33624_flow4_numb_display[flow_numb];
	s_bit=addr2>>3;
	if(s_bit>7)
	{
		addr1=0x21;
	}else
	{
		addr1=0x20;
	}
	AiP33624_WriteData2(addr1,AiP33624_flow4_numb_display[flow_numb]|0xc0,0x00,0xff);
}

void AiP33624_flow_display_control(void)
{


    if(ring_numb_count<=6)
    {
    	AiP33624_flow1_display_control(ring_numb_count);
	    ring_numb_count++;

    }
    if(ring_numb_count>6)
    {
    	if(ring_numb_count2<=12)
    	{
	    	AiP33624_flow2_display_control(ring_numb_count2);
	    	ring_numb_count2++;
    	}
    	if(ring_numb_count2>12)
    	{
    		if(ring_numb_count3<=5)
    		{
	    		AiP33624_flow3_display_control(ring_numb_count3);
	    		ring_numb_count3++;
    		}

    	}

    }
}
*/

void AiP33624_all_show(void)
{
	AiP33624_WriteData(0xc0,0x7f);

}

void AiP33624_all_close(void)
{
	AiP33624_WriteData(0xc0,0x00);

}
void AiP33624_all_breath_close(void)
{
	uint8_t close_count=0;
	uint8_t s_bit=0;
	uint8_t addr1=0;
	uint8_t addr2=0;
	for(close_count;close_count<41;close_count++){
	addr2=breath_show_tab[close_count];
	s_bit=addr2>>3;
	if(s_bit>7)
	{
		addr1=0x21;
	}else
	{
		addr1=0x20;
	}
	AiP33624_WriteData1(addr1,breath_show_tab[close_count]|0xc0,0x00);
	}

}


void breath_led_all_show_control(uint8_t breath_count ,uint8_t light_level)
{
	uint8_t s_bit=0;
	uint8_t addr1=0;
	uint8_t addr2=0;
	addr2=breath_show_tab[breath_count];
	s_bit=addr2>>3;
	if(s_bit>7)
	{
		addr1=0x21;
	}else
	{
		addr1=0x20;
	}
	AiP33624_WriteData1(addr1,breath_show_tab[breath_count]|0xc0,light_level);
}

void breath_ring_all_show_control(uint8_t breath_count ,uint8_t light_level)
{
	uint8_t s_bit=0;
	uint8_t addr1=0;
	uint8_t addr2=0;
	addr2=Aip_33624_ring_tab[breath_count];
	s_bit=addr2>>3;
	if(s_bit>7)
	{
		addr1=0x21;
	}else
	{
		addr1=0x20;
	}
	AiP33624_WriteData1(addr1,Aip_33624_ring_tab[breath_count]|0xc0,light_level);
}

void breath_led_all_show(void)
{
		uint8_t	breath_count=0;
		for(breath_count;breath_count<=40;breath_count++)
		{
			breath_led_all_show_control(breath_count,0xff);
		}
}

void breath_led_all_close(void)
{
		uint8_t	breath_count=0;
		for(breath_count;breath_count<=40;breath_count++)
		{
			breath_led_all_show_control(breath_count,0x00);
		}
}

void Aip33624_breath_led_control(void)
{
	uint8_t	breath_count=0;
	//static uint8_t num=0;
		if(0==breath_time)
		{
			breath_number+=1;
		}
		else if(1==breath_time)
		{
			breath_number-=1;
		}
		if((breath_time==1)&&(breath_number==0))
		{
			breath_time=0;
		}
		else if((breath_time==0)&&(breath_number==63))
		{
			breath_time=1;
		}
		for(breath_count;breath_count<=40;breath_count++)
		{
			breath_led_all_show_control(breath_count,tab_Breathing_light[breath_number]);
			
		}
	
}
void Aip33624_breath_ring_control(void)
{
	uint8_t	breath_count=0;
	//static uint8_t num=0;
		if(0==breath_time1)
		{
			breath_number1+=1;
		}
		else if(1==breath_time1)
		{
			breath_number1-=1;
		}
		if((breath_time1==1)&&(breath_number1==0))
		{
			breath_time1=0;
		}
		else if((breath_time1==0)&&(breath_number1==63))
		{
			breath_time1=1;
		}
		for(breath_count;breath_count<=14;breath_count++)
		{
			breath_ring_all_show_control(breath_count,tab_Breathing_light[breath_number1]);
		}
	
}

//6个按键编码数组
uint8_t button_numb_display[14]=
{
		//右键
		g3|s3,

		//左键
		g5|s7,

		//自助
		g1|s8,g1|s9,g1|s10,
		//爆炒
		g1|s5,g1|s4,g1|s3,

		//定时
		g5|s8,g5|s9,g5|s10,

		//风速
		g3|s4,g3|s6,g3|s1

};



void button_all_show(void)
{
	uint8_t s_bit=0;
	uint8_t addr1=0;
	uint8_t addr2=0;
	int i=0;
	for(i;i<14;i++)
	{
		addr2=button_numb_display[i];
		s_bit=addr2>>3;
		if(s_bit>7)
		{
			addr1=0x21;
		}else
		{
			addr1=0x20;
		}
		AiP33624_WriteData1(addr1,button_numb_display[i]|0xc0,0xff);
	}

}
void button_all_close(void)
{
	uint8_t s_bit=0;
	uint8_t addr1=0;
	uint8_t addr2=0;
	int i=0;
	for( i;i<14;i++)
	{
		addr2=button_numb_display[i];
		s_bit=addr2>>3;
		if(s_bit>7)
		{
			addr1=0x21;
		}else
		{
			addr1=0x20;
		}
		AiP33624_WriteData1(addr1,button_numb_display[i]|0xc0,0x0);
	}

}
void func_button_half_display(void)
{
	//右
	AiP33624_WriteData1(0x20,button_numb_display[0]|0xc0,0x7f);
	//左
	AiP33624_WriteData1(0x20,button_numb_display[1]|0xc0,0x7f);
	//自助 1
	AiP33624_WriteData1(0x20,button_numb_display[2]|0xc0,0x7f);
	AiP33624_WriteData1(0x21,button_numb_display[3]|0xc0,0x7f);
	AiP33624_WriteData1(0x21,button_numb_display[4]|0xc0,0x7f);
	//爆炒 2
	AiP33624_WriteData1(0x20,button_numb_display[5]|0xc0,0x7f);
	AiP33624_WriteData1(0x20,button_numb_display[6]|0xc0,0x7f);
	AiP33624_WriteData1(0x20,button_numb_display[7]|0xc0,0x7f);
	//定时 3
	AiP33624_WriteData1(0x20,button_numb_display[8]|0xc0,0x7f);
	AiP33624_WriteData1(0x21,button_numb_display[9]|0xc0,0x7f);
	AiP33624_WriteData1(0x21,button_numb_display[10]|0xc0,0x7f);
	//风速4
	AiP33624_WriteData1(0x20,button_numb_display[11]|0xc0,0x7f);
	AiP33624_WriteData1(0x20,button_numb_display[12]|0xc0,0x7f);
	AiP33624_WriteData1(0x20,button_numb_display[13]|0xc0,0x7f);
}
void func_button_half_display_control(uint8_t mode_select,uint8_t status)
{
	//func_button_half_display();
	switch(mode_select)
	{
	case 1:

		if(status==1)
		{
			AiP33624_WriteData1(0x20,button_numb_display[2]|0xc0,0xff);
			AiP33624_WriteData1(0x21,button_numb_display[3]|0xc0,0xff);
			AiP33624_WriteData1(0x21,button_numb_display[4]|0xc0,0xff);
		}else if(status==2)
		{
			AiP33624_WriteData1(0x20,button_numb_display[2]|0xc0,half_show_value);
			AiP33624_WriteData1(0x21,button_numb_display[3]|0xc0,half_show_value);
			AiP33624_WriteData1(0x21,button_numb_display[4]|0xc0,half_show_value);

		}else if(status==0)
		{
			AiP33624_WriteData1(0x20,button_numb_display[2]|0xc0,0x00);
			AiP33624_WriteData1(0x21,button_numb_display[3]|0xc0,0x00);
			AiP33624_WriteData1(0x21,button_numb_display[4]|0xc0,0x00);
		}
		break;
	case 2:
		if(status==1)
		{
			AiP33624_WriteData1(0x20,button_numb_display[5]|0xc0,0xff);
			AiP33624_WriteData1(0x20,button_numb_display[6]|0xc0,0xff);
			AiP33624_WriteData1(0x20,button_numb_display[7]|0xc0,0xff);
		}else if(status==2)
		{
			AiP33624_WriteData1(0x20,button_numb_display[5]|0xc0,half_show_value);
			AiP33624_WriteData1(0x20,button_numb_display[6]|0xc0,half_show_value);
			AiP33624_WriteData1(0x20,button_numb_display[7]|0xc0,half_show_value);
		}else if(status==0)
		{
			AiP33624_WriteData1(0x20,button_numb_display[5]|0xc0,0x00);
			AiP33624_WriteData1(0x20,button_numb_display[6]|0xc0,0x00);
			AiP33624_WriteData1(0x20,button_numb_display[7]|0xc0,0x00);

		}


		break;
	case 3:
		//timing
		if(status==1)
		{
			AiP33624_WriteData1(0x20,button_numb_display[8]|0xc0,0xff);
			AiP33624_WriteData1(0x20,button_numb_display[9]|0xc0,0xff);
			AiP33624_WriteData1(0x21,button_numb_display[10]|0xc0,0xff);
		}else if(status==2)
		{
			AiP33624_WriteData1(0x20,button_numb_display[8]|0xc0,half_show_value);
			AiP33624_WriteData1(0x20,button_numb_display[9]|0xc0,half_show_value);
			AiP33624_WriteData1(0x21,button_numb_display[10]|0xc0,half_show_value);
		}else if(status==0)
		{
			AiP33624_WriteData1(0x20,button_numb_display[8]|0xc0,0x00);
			AiP33624_WriteData1(0x20,button_numb_display[9]|0xc0,0x00);
			AiP33624_WriteData1(0x21,button_numb_display[10]|0xc0,0x00);
		}

		//右
		AiP33624_WriteData1(0x21,button_numb_display[0]|0xc0,half_show_value);
		//左
		AiP33624_WriteData1(0x20,button_numb_display[1]|0xc0,half_show_value);
		break;
	case 4:
		if(status==1)
		{
			AiP33624_WriteData1(0x20,button_numb_display[11]|0xc0,0xff);
			AiP33624_WriteData1(0x20,button_numb_display[12]|0xc0,0xff);
			AiP33624_WriteData1(0x21,button_numb_display[13]|0xc0,0xff);
		}else if(status==2)
		{
			AiP33624_WriteData1(0x20,button_numb_display[11]|0xc0,half_show_value);
			AiP33624_WriteData1(0x20,button_numb_display[12]|0xc0,half_show_value);
			AiP33624_WriteData1(0x21,button_numb_display[13]|0xc0,half_show_value);
		}else if(status==0)
		{
			AiP33624_WriteData1(0x20,button_numb_display[11]|0xc0,0x00);
			AiP33624_WriteData1(0x20,button_numb_display[12]|0xc0,0x00);
			AiP33624_WriteData1(0x21,button_numb_display[13]|0xc0,0x00);
		}

		break;
	default:
		break;
	}

}
